A 36-year-old man was sentenced Tuesday to two to five years in state prison for attempting to meet a 12-year-old-girl for a sexual encounter.